<?php
require_once '../../Lib/main.php';
try {
	$page = $_REQUEST['page'];
	$start = $_REQUEST['start'];
	$limit = $_REQUEST['limit'];
	
	$categoryDAO = new Dao_CategoryDAO();
	$listCategory = $categoryDAO->getCategoryWithoutDelete($start, $limit);
	
	$cnt = $categoryDAO->countCategoryWithoutDelete();
	$arr = array();
	/* @var $category Model_Category */
	foreach ($listCategory as $key => $category) {
		$inArr = array();
		$inArr['id'] = $category->getId();
		$inArr['name'] = $category->getName();
		$inArr['orderIndex'] = $category->getOrderIndex();
		$inArr['delStatus'] = $category->getDeleteFlgByString();
		$arr[] = $inArr;
	}
	
	echo json_encode(array('success' => true, 'items' => $arr, 'total' => $cnt));
	
} catch (Exception $e) {
	echo json_encode(array('success' => false,'error' => $e->getMessage()));
}


